<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:c="http://java.sun.com/jsp/jstl/core"
        xmlns:components="http://java.sun.com/jsf/composite/components"
>
   <head>

      <link href="#{request.contextPath}/resources/css/main.css" rel="stylesheet"/>
   </head>
   <body>
      <h2>Customers list</h2>
      <div>
         <table class="blueTable">
            <thead>
               <tr>
                  <th>Name</th>
                  <th>Address</th>
                  <th>Email</th>
                  <th>Edit</th>
                  <th>Delete</th>
               </tr>
            </thead>
            <c:forEach var="customer" items="${customers}">
               <tr>
                  <td >${customer.name}</td>
                  <td>${customer.address}</td>
                  <td>${customer.email}</td>
                  <td><a href="#{request.contextPath}/mvc/customers/edit/${customer.id}">Edit</a></td>
                  <td><a href="#{request.contextPath}/mvc/customers/delete/${customer.id}">Delete</a></td>
               </tr>
            </c:forEach>
            <c:if test="${empty customers}">
               No Customers in the database.
            </c:if>
         </table>

         <form method="GET" action="#{request.contextPath}/mvc/customers/new">
            <button class="myButton" type="submit">Add new</button>
         </form>
      </div>
   </body>
</html>

